package com.futureCloudMOM.core.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.futureCloudMOM.common.constant.GenConstants;
import com.futureCloudMOM.core.entity.FBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Produce_TaskBillRoutingParam", description = "生产订单工艺工序加工参数")
@TableName(value = "Produce_TaskBillRoutingParam")
public class ProduceTaskBillRoutingParam extends FBaseEntity implements Serializable {



    @NotNull(message="[生产订单工艺工序ID]不能为空")
    @ApiModelProperty("生产订单工艺工序ID")
    @TableField(value = "taskBillRoutingProcessId")
    private Long taskBillRoutingProcessId;

    @NotBlank(message="[参数编码]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("参数编码")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "code")
    private String code;

    @NotBlank(message="[参数名称]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("参数名称")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "name")
    private String name;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("备注")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "remark")
    private String remark;

    @NotNull(message="[状态]不能为空")
    @ApiModelProperty("状态")
    @TableField(value = "status")
    private Long status;

    @NotBlank(message="[最大值]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("最大值")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "maxValue")
    private String maxValue;

    @NotBlank(message="[最小值]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("最小值")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "minValue")
    private String minValue;

    @ApiModelProperty("参数类型")
    @TableField(value = "controlType")
    private Long controlType;

    @NotBlank(message="[标准值]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("标准值")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "standardValue")
    private String standardValue;

    @ApiModelProperty("允许编辑标记")
    @TableField(value = "allowEditFlag")
    private Long allowEditFlag;


    /**
     * 根据工艺工序参数获取实例
     *
     * @param routingParam 工艺工序参数
     * @return 实例
     */
    public static ProduceTaskBillRoutingParam getInstance(BasicRoutingParam routingParam) {
        String[] ignoreProperties = GenConstants.F_BASE_ENTITY;
        ProduceTaskBillRoutingParam taskBillRoutingParam = new ProduceTaskBillRoutingParam();
        BeanUtils.copyProperties(routingParam, taskBillRoutingParam, ignoreProperties);
        return taskBillRoutingParam;
    }



}

